package com.ysy.logistics.entities.supplier.vo;

import com.ysy.logistics.entities.supplier.SupGoods;
import com.ysy.logistics.entities.supplier.Supplier;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/**
 * @ClassDescription: 供应商查询对象
 * @Author:姚斯羽
 * @Create:2025/3/25 16:24
 **/
@Data
@Schema(description = "供应商查询对象")
public class SupplierQueryVO {

    @Schema(description = "供应商名称")
    private String supName;
    @Schema(description = "联系人")
    private String contact;
    @Schema(description = "供应商电话")
    private String phone;
    @Schema(description = "供应商地址")
    private String address;
    @Schema(description = "商品名称")
    private String goodsName;

    public Supplier toSupplier() {
        Supplier supplier = new Supplier();
        supplier.setName(supName);
        supplier.setContact(contact);
        supplier.setPhone(phone);
        supplier.setAddress(address);
        return supplier;
    }

    public SupGoods toSupGoods() {
        SupGoods supGoods = new SupGoods();
        supGoods.setName(goodsName);
        return supGoods;
    }

    public boolean supplierConditionEmpty() {
       return StringUtils.isBlank(supName)&&StringUtils.isBlank(contact)&&StringUtils.isBlank(phone)&&StringUtils.isBlank(address);
    }

    public boolean supGoodsConditionEmpty() {
        return StringUtils.isBlank(goodsName);
    }
}
